package com.dnb.webmash.playmaker.shared;

public enum PlayerType {
	FLASH(0), IFRAME(1), EMBED(2), SCRIPT(3), FILE(4);
	private int value;
	
	PlayerType(int value) {
		this.value = value;
	}
	
	public int getValue() {
		return value;
	}
	
	public static PlayerType get (int type) {
		for (PlayerType playerType : PlayerType.values()) {
			if (playerType.getValue() == type) {
				return playerType;
			}
		}		
		return null;
	}

	public static String getDescription(int type) {
		switch (PlayerType.get(type)) {
		case FLASH:
			return "Flash player options:<br>" +
					"src = Full URL of Item. == sourceURL + mediaID found for each mediaIDPat<br><br>" +
					"Player description: <br>" +
					"An object element with an embed element with a src attribute and a type=application/x-shockwave-flash attribute and an allowScriptAccess=always attribute.<br>" +
					"The object element also has a series of param children; first one with an allowFullScreen=true attribute, second one with an allowScriptAccess=always attribute.";
			
		case IFRAME:
			return "Iframe player options:<br>" +
					"src = Full URL of Item. == sourceURL + mediaID found for each mediaIDPat<br><br>" +
					"Player description: <br>" +
					"An iframe element with a src attribute, a frameborder=0 attribute, and an allowScriptAccess=always attribute.";
		case EMBED: 
			return "Embed player options:<br>" +
					"Inner HTML = Selected element.<br><br>" +
					"Player description: <br>" +
					"A media element containing the selected element.";
		case SCRIPT:
			return "Script player options:<br>" +
					"src = Selected Element<br><br>" +
					"Player description: <br>" +
					"A div element with a script element of type=text/javascript and a src attribute.";
		case FILE:
			return "File player options:" +
					"data = Full URL of Item. == sourceURL + mediaID found for each mediaIDPat<br><br>" +
					"Player description: <br>" +
					"An object element with a data attribute.";
		default:
			return "null playertype!";
		}
	}
}
